package com.lin.utils;
import org.springframework.core.convert.converter.Converter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 自定义类型转换
 *
 */
public class ConvertDate implements Converter<String, Date> {
    @Override
    public Date convert(String s) {
        DateFormat date = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = null;
        try {
            parse = date.parse(s);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return parse;
    }
}
